function toLogin(phone, password) {
	if(phone != "" && password != "") {
		$.ajax({
			url: urlcore + "/api/login/loginPhoneweixin",
			type: "POST",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			data: JSON.stringify({
				phone: phone,
				password: password
			}),
			success: function(da) {
				if(da.success == true) {
					//alert(JSON.stringify(da.data.data.id));
				/*	console.log(da.data.id);
                   console.log(da.data);
                   	console.log(da.data.id);*/
					//设置cookie
					var domain_url = urlcore.split('://')[1];
					if(domain_url.indexOf(':') > -1) {
						domain_url = domain_url.split(':')[0];
					} else {
						domain_url = domain_url.split('/')[0];
					}
	document.cookie = "sid=" + da.data.data.token + ";path=/;domain=" + domain_url;
				// alert(document.cookie);
			window.location.href = "index.html";
				}else{
					alert(da.msg);
				}
			},
			error: function() {
				/* Act on the event */
				alert("error");
			}
		});
	}

}
function login() {
	var passwotde1 = $("#passwotde1").val();
	var passwotde2 = $("#passwotde2").val();
	sessionStorage.setItem("password",passwotde1);

	var phone=sessionStorage.getItem("phone");
	//var codess=sessionStorage.getItem("codess");
	var password=sessionStorage.getItem("password");
	if(sessionStorage.getItem("phone")==""&&sessionStorage.getItem("password")) {
		window.location.href="gotoindex.html";
	}else{
		if(passwotde1 == passwotde2) {
			$.ajax({
			url: urlcore + "/api/user/wxGzHToLogin",
			type: "POST",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			data: JSON.stringify({
				phone: phone,
				password: password 
			}),
			success:function(data){
				//console.log(1,data);
				if(data.success == true) {
				 var da=data.data;
				 
				 					if(window.sessionStorage) {
				 						//登录名
				 						//sessionStorage.setItem("userName", da.userName);
				 						//登录类型
				 						///sessionStorage.setItem("userType", da.userType);
				 						//sessionStorage.setItem("userId", da.id);
				 						//ryToken
				 						//sessionStorage.setItem("ryToken", da.ryToken);
				 						//设置cookie
				 						var domain_url = urlcore.split('://')[1];
				 						if(domain_url.indexOf(':') > -1) {
				 							domain_url = domain_url.split(':')[0];
				 						} else {
				 							domain_url = domain_url.split('/')[0];
				 						}
				 						document.cookie = "JSESSIONID=" + data.data.token + ";path=/;domain=" + domain_url;
				 
				 						//	sessionStorage.setItem("userId",da.id);
				 						window.location.href = "index.html";
				 					} else {
				 						layer.alert("浏览暂不支持sessionStorage");
				 					}
               // sessionStorage.setItem("token",data.data.token);
	
							// window.location.href="buy/12.0.0buy_wode.html";
				
							} else if(data.code == 'OVERTIME') {
								var thisUrl = window.location.href;
								if(thisUrl.indexOf('login.html') <= -1) {
									//top.window.location.href = "login.html";
								}
							}
							else {
								alert(data.msg);
							}
				
						}
			}
		   
			)
		   // window.location.href="buy/12.0.0buy_wode.html";
			 // window.location.href="index.html";
		} else {
		alert("密码不一致!");
   }
	}
}